package com.syyo.common.utils;


import java.util.List;

/**
 * @Auther: wangzhong
 * @Date: 2019/10/16 09:43
 * @Description:
 */
public class MyStringUtils {

    /**
     * 将整型列表转换为字符串 [0,2,4] => "0,2,4"
     *
     * @param list
     * @return
     */
    public static String getPids(List<Long> list) {
        String pids = "";
        if (list != null && list.size() > 0) {
            for (Long integer : list) {
                pids = pids + "," + integer;
            }
            return pids.substring(1, pids.length());
        }
        return "0";
    }

    /**
     * 将整型列表转换为字符串 [0,2,4] => "0,2,4"
     *
     * @param list
     * @return
     */
    public static Integer getRank(List<Long> list) {
        if (list != null && list.size() > 0) {
            return list.size() + 1;
        }
        return 1;
    }

    /**
     * 获取列表的最后一位数
     *
     * @param list
     * @return
     */
    public static Long getPid(List<Long> list) {
        if (list != null && list.size() > 0) {
            return list.get(list.size() - 1);
        }
        return 0L;

    }


}
